﻿@using System.Text.Encodings.Web;
@{

    //success messages
    var successMessages = new List<string>();
    if (TempData[string.Format("Grand.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.AddRange(TempData[string.Format("Grand.notifications.{0}", NotifyType.Success)] as IList<string>);
    }
    if (ViewData[string.Format("Grand.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.AddRange(ViewData[string.Format("Grand.notifications.{0}", NotifyType.Success)] as IList<string>);
    }

    //error messages
    var errorMessages = new List<string>();
    if (TempData[string.Format("Grand.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.AddRange(TempData[string.Format("Grand.notifications.{0}", NotifyType.Error)] as IList<string>);
    }
    if (ViewData[string.Format("Grand.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.AddRange(ViewData[string.Format("Grand.notifications.{0}", NotifyType.Error)] as IList<string>);
    }
}
@foreach (var message in successMessages)
{
    <script asp-location="Footer">
        $(document).ready(function () {
            displayPopupNotification('@Html.Raw(JavaScriptEncoder.Default.Encode(message))', 'success', false);
        });
    </script>
}
@foreach (var message in errorMessages)
{
    <script asp-location="Footer">
        $(document).ready(function () {
            displayPopupNotification('@Html.Raw(JavaScriptEncoder.Default.Encode(message))', 'error', false);
        });
    </script>
}
<div class="ajax-loading-block-window" style="display: none">
    <div id="loading"><div class="loader"></div></div>
</div>

<div id="bar-notification" class="generalNote"></div>

@await Component.InvokeAsync("PopupAction")

<div class="modal fade" id="ModalAddToCart" tabindex="-1" role="dialog" aria-hidden="true">
</div>
<div class="modal fade" id="ModalQuickView" tabindex="-2" role="dialog" aria-hidden="true">
</div>
<div class="modal fade" id="ModalPrivacyPreference" tabindex="-3" role="dialog" aria-hidden="true">
</div>
<a class="nc-action-form" data-mfp-src="#nc_modal_form" style="display:none"></a>
<div id="nc_modal_form" class="zoom-anim-dialog mfp-hide">
</div>
<div class="modal fade" id="generalModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-header p-0 border-bottom-0">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body p-0">
                <div id="dialog_error"></div>
                <div id="dialog_success"></div>
            </div>
        </div>
    </div>
</div>
